package org.interview.ms.string;

public class SimpleStringReverse {

	public static void main(String[] args) {

		String str01 = "ab cd ef gh";
		String str02 = null;

		// str01 = new StringBuffer(str01).reverse().toString();

		char[] initialArray = str01.toCharArray();

		int strLength = str01.length();

		if (strLength > 0) {

			char[] reversedArray = new char[strLength];
			for (int index = 0; index < initialArray.length; index++) {
				reversedArray[initialArray.length - index - 1] = initialArray[index];
			}
				str02 = new String(reversedArray);
		}

		System.out.println(str01);
		System.out.println(str02);

	}

}
